package com.douwong.student.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @autor yichao
 * @time 2016/9/2210:06
 * @des 状态码
 */

public enum E_State {
    /**教师发给学生或学生发给教师成功，默认值*/
    teacherStudentOK(0),
    /** 登陆服务端成功*/
    loginSuccess(1),
    /**登陆服务端失败*/
    loginFailed(2),
    /** 强制踢出服务端登录*/
    kickOut(3),
    /**学生端登录成功并反馈给教师端*/
    studentLoginSuccess(4),
    /**云请求成功*/
    reqCloudOk(5),
    /**未找到教师或教师不在线*/
    notFoundTeacher(6),
    /**未找到学生或学生不在线*/
    notFoundStudent(7),
    /**教师登录成功并反馈给所有在线学生*/
    teacherLoginSuccess(8);
    private    int value;
    E_State(int value) {
        this.value=value;
    }

    public void setValue(int value) {
        this.value = value;
    }
    @JsonValue
    public int getValue() {
        return value;
    }
    @JsonCreator
    public static E_State getItem(int value){
        for(E_State item :values()){
            if (item.getValue()==value){
                return item;
            }
        }
        return null;
    }
}
